/**
 */
package website.impl;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

import website.Action;
import website.ActiveContent;
import website.WebsitePackage;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Active Content</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link website.impl.ActiveContentImpl#getTriggeredAction <em>Triggered Action</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public abstract class ActiveContentImpl extends ContentImpl implements ActiveContent {
	/**
	 * The cached value of the '{@link #getTriggeredAction() <em>Triggered Action</em>}' containment reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTriggeredAction()
	 * @generated
	 * @ordered
	 */
	protected Action triggeredAction;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ActiveContentImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return WebsitePackage.Literals.ACTIVE_CONTENT;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Action getTriggeredAction() {
		return triggeredAction;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetTriggeredAction(Action newTriggeredAction, NotificationChain msgs) {
		Action oldTriggeredAction = triggeredAction;
		triggeredAction = newTriggeredAction;
		if (eNotificationRequired()) {
			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, WebsitePackage.ACTIVE_CONTENT__TRIGGERED_ACTION, oldTriggeredAction, newTriggeredAction);
			if (msgs == null) msgs = notification; else msgs.add(notification);
		}
		return msgs;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setTriggeredAction(Action newTriggeredAction) {
		if (newTriggeredAction != triggeredAction) {
			NotificationChain msgs = null;
			if (triggeredAction != null)
				msgs = ((InternalEObject)triggeredAction).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - WebsitePackage.ACTIVE_CONTENT__TRIGGERED_ACTION, null, msgs);
			if (newTriggeredAction != null)
				msgs = ((InternalEObject)newTriggeredAction).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - WebsitePackage.ACTIVE_CONTENT__TRIGGERED_ACTION, null, msgs);
			msgs = basicSetTriggeredAction(newTriggeredAction, msgs);
			if (msgs != null) msgs.dispatch();
		}
		else if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, WebsitePackage.ACTIVE_CONTENT__TRIGGERED_ACTION, newTriggeredAction, newTriggeredAction));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case WebsitePackage.ACTIVE_CONTENT__TRIGGERED_ACTION:
				return basicSetTriggeredAction(null, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case WebsitePackage.ACTIVE_CONTENT__TRIGGERED_ACTION:
				return getTriggeredAction();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case WebsitePackage.ACTIVE_CONTENT__TRIGGERED_ACTION:
				setTriggeredAction((Action)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case WebsitePackage.ACTIVE_CONTENT__TRIGGERED_ACTION:
				setTriggeredAction((Action)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case WebsitePackage.ACTIVE_CONTENT__TRIGGERED_ACTION:
				return triggeredAction != null;
		}
		return super.eIsSet(featureID);
	}

} //ActiveContentImpl
